<!DOCTYPE HTML>
<html>
<head>
    <title>Error</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/stylesheets/formdata.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">

    <script src="/scripts/miniui/miniui.js"></script>
    <script src="/qiniuJs/formdata.js"></script>

</head>
<body>
<div class="container">
    <!-- Document：https://developer.qiniu.com/kodo/manual/form-upload -->
    <form id="testform" method="post" enctype="multipart/form-data">
        <input name="key" id="key" type="hidden" value="">
        <input name="token" type="hidden" value="<%= uptoken %>">
        <input id="userfile" name="file" type="file" />
        <!-- take photo with phone -->
        <!-- <input id="userfile" name="file" accept="image/*" type="file" /> -->
        <!-- take video with phone -->
        <!-- <input id="userfile" name="file" type="file" accept="video/*"/> -->
        <input name="accept" type="hidden" />
    </form>
    <!-- add file -->
    <label for="userfile">
        <span></span>
        <em>添加Android apk</em>
    </label>

    <!-- upload info -->
    <div class="selected-file"></div>
    <div class="progress"></div>
    <div class="uploaded-result"></div>
 </div>
<div id="form1" style="padding-left: 30px">
    <span style="width:80px;display:inline-block;">版本号：</span>
    <input id="versionNo" name="versionNo" class="mini-textbox" required="true" style="width:155px;" />

    <span style="width:80px;display:inline-block;">版本名称：</span>
    <input id="versionName"  name="versionName" class="mini-textbox"  required="true" style="width:155px;"  />
    <br/><br/>

    <span style="width:80px;display:inline-block;">创建人：</span>
    <input id="creater" name="creater" class="mini-textbox" style="width:155px;" />

    <span style="width:80px;display:inline-block;">desUrl：</span>
    <input id="desUrl" name="desUrl" class="mini-textbox" required="true" style="width:155px;" />
    <br/><br/>

    <input id="downUrl" class="mini-textbox" style="display: none"/>

    <span style="width:80px;display:inline-block;">更新内容：</span>
    <textarea id="content" name="content" class="mini-textarea"  style="width: 400px;height: 100px"></textarea>

    <br/><br/>
    <div style="margin: 0 auto;text-align: center">
        <a class="mini-button " iconCls="icon-ok" onclick="updataShop()">确定</a>
        <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
    </div>
</div>
</body>
<script>
    var domain = "<%- domain %>";
    function updataShop() {
        var form = new mini.Form("#form1");
        form.validate();
        if (form.isValid() == false) {
            alert("请正确填写数据")
            return
        };
        var downUrl = mini.get("downUrl").getValue();
        var versionNo = mini.get("versionNo").getValue();
        var versionName = mini.get("versionName").getValue();
        var creater = mini.get("creater").getValue();
        var content = mini.get("content").getValue();
        var desUrl = mini.get("desUrl").getValue();
        console.log(downUrl);

        $.ajax({
            type: "POST",
            url: "/getdata/update/android",
            data:{
                downUrl:downUrl,
                versionNo:versionNo,
                versionName:versionName,
                creater:creater,
                content:content,
                desUrl:desUrl
            },

            success: function (result) {
                CloseWindow("save");
            }
        })
    }
    //    关闭窗口
    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }



</script>
</html>